/****************************************************************************/
/****************************************************************************/
/*                                                                          */
/* This file contains the interface functions                               */
/* you should use for the wet ex 1                                                                       */ 
/*                                                                          */ 
/****************************************************************************/
/****************************************************************************/

/****************************************************************************/
/*                                                                          */ 
/* File Name : library1.h                                                   */ 
/*                                                                          */ 
/****************************************************************************/

#ifndef _234218_WET1_06_08 
#define _234218_WET1_06_08


#ifdef __cplusplus
extern "C" {
#endif


// return values
enum StatusType  {
	SUCCESS = 0,
	FAILURE = -1,
	BANNED = -2,
	ALLOCATION_ERROR = -3};


// required interface to data structure
// ------------------------------------

// initialize data structure
// input: none
// return: SUCCESS or NULL in case of allocation error
void* init(int S);

// add a new fan 
// input: DS - the data structure
//		  id - fan id (id > 0)
//		  stand - the stand number (0 <= stand < S)
//		  chair - the chair number (chair >= 0)
//		  team - the fan's team, 0  for Maccabi, 1 for Hapoel
// return: BANNED - if fan is banned
//		   FAILURE - all other errors except allocation
//		   ALLOCATION_ERROR - in case of allocation error
//		   SUCESS - otherwise
StatusType newFan(void* DS, int id, int stand, int chair, int team);

// ban a fan from entering the stadium
// input: DS - the data structure
//		  stand - the stand number (0 <= stand < S)
//		  chair - the chair number (chair >= 0)
// return: FAILURE - all possible errors
//		   SUCESS - otherwise
StatusType banFan(void* DS, int stand, int chair);

// get fan's stand and chair by id
// input: DS - the data structure
//		  id - fan id (id > 0)
// output: stand - the stand number
//		   chair - the chair number
// return: FAILURE - all possible errors
//		   SUCESS - otherwise
StatusType getChair(void* DS, int id, int * stand, int * chair);

// get number of Maccabi fans in the stand
// input: DS - the data structure
//		  stand - the stand number (0 <= stand < S)
// output: numFans - the number of Maccabi fans in the stand
// return: FAILURE - all possible errors
//		   SUCESS - otherwise
StatusType getNumMaccabiFans(void* DS, int stand, int * numFans);

// get number of Hapoel fans in the stand
// input: DS - the data structure
//		  stand - the stand number (0 <= stand < S)
// output: numFans - the number of Hapoel fans in the stand
// return: FAILURE - all possible errors
//		   SUCESS - otherwise
StatusType getNumHapoelFans(void* DS, int stand, int * numFans);

// get the number of free chairs to the left of specified location
// input: DS - the data structure
//		  stand - the stand number (0 <= stand < S)
//		  chair - the chair number (chair >= 0)
// output: freeChairs - the number of free chairs
// return: FAILURE - all possible errors
//		   SUCESS - otherwise
StatusType getNumFreeChairs(void* DS, int stand, int chair, int * freeChairs);

// separate the team fans in the two stands
// input: DS - the data structure
//		  stand1 - the first stand's number (0 <= stand < S)
//		  stand2 - the second stand's number (0 <= stand < S)
// return: FAILURE - all possible errors
//		   SUCESS - otherwise
StatusType separateStands(void* DS, int stand1, int stand2);

// determine if current implementation is implementing bonus function
// return: 0 if not implementing bonus function
//		   1 if implementing bonus function
int isImplementingBonus(void* DS);

// delete the data structure
// input: DS - the data structure
void quit(void* DS);


#ifdef __cplusplus
}
#endif

#endif    /*_234218_WET1_06_08 */ 
